package com.example.controller;

import com.example.pojo.dto.HomeCompanyDTO;
import com.example.pojo.dto.HomePosterDTO;
import com.example.service.HomeCompanyService;
import com.example.service.HomePosterService;
import com.example.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.TimeoutUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;

/**
 * 本文来演示:主页的controller
 *
 * @author 赵建云
 * @create 2023/10/9
 */
@RestController
@RequestMapping("home")
public class HomeController {
    @Autowired
    private HomePosterService homePosterService;
    @Autowired
    private HomeCompanyService homeCompanyService;
    @Autowired
    private RedisTemplate redisTemplate;
    @GetMapping("poster")
    public Result getPoster(Integer jsId){
        if (jsId==null){
            List<HomePosterDTO> list = homePosterService.findAllPoster();
            return new Result(200,"所有职位",list);
        }else {
            List<HomePosterDTO> list = homePosterService.findByPosId(jsId);
            return new Result(200,"success",list);
        }
    }
    @GetMapping("company")
    public Result getCompany(){
        List<HomeCompanyDTO> list = homeCompanyService.findCompany();
        System.out.println(list);
        return new Result(200,"企业信息",list);
    }
}
